
// 获取角色列表
import request from "@/utils/request";

export function getRoles () {
  return request.get('/v1/roles/list')
}

// 创建角色
export function createRole (data) {
    return request.post('/v1/roles/create', data)
}

// 更新角色
export function updateRole (id, data) {
    return request.post(`/v1/roles/update/${id}`, data)
}

// 删除角色
export function deleteRole (id) {
    return request.post(`/v1/roles/delete/${id}`)
}

// 分配菜单
export function assignMenuToRole (roleId, menuIds) {
    return request.post('/v1/roles/menu/assign', { roleId, menuIds })
}

// 分配权限
export function assignPermissionToRole (roleId, permissionIds) {
    return request.post('/v1/roles/permission/assign', { roleId, permissionIds })
}
